/* 
 * File:   No.h
 * Author: nata
 *
 * Created on March 13, 2012, 3:13 PM
 */

#ifndef NO_H
#define	NO_H

#include <vector>
#include "Image.h"

using namespace std;

enum Type {
    BISS,
    LEAF
};

enum Orientation {
    HORIZONTAL,
    VERTICAL
};

class Node {
private:
    Type type;
    Orientation orientation;
    Image* image;
    Node* left;
    Node* right;
    Node* father;
    int id;
    
public:
    //Node(Type type);
    Node(Image* image);
    Node(Image* image, int id);
    Node(Node* left, Orientation orientation, Node* right);
    Node(Node* node); //copy
    
    void set_bissection(Node* left, Orientation orientation, Node* right);
    void set_leaf(Image* image);
    void set_left(Node* left);
    void set_right(Node* right);
    void set_father(Node* father);

    Image* get_image();
    Node* get_father();
    Orientation get_orientation();
    Node* get_left();
    Node* get_right();

    int get_height(int alpha, int beta);
    int get_width(int alpha, int beta);
    int get_area(int alpha, int beta);
    Type get_type();
    int get_id();
    void set_id(int id);
    void enumerate(); //
    bool is_leaf();
    double sum_image_areas();
    double sum_relative_areas();
    int sum_filled_area(int alpha, int beta);
    
    void get_leafs(vector<Node*> *leafs);
};

#endif	/* NO_H */

